<template>
    <div class="ea-tab-pane" v-if="isActive">
        <slot></slot>
    </div>
</template>

<script setup lang="ts">
import { computed, defineProps, inject, ref } from 'vue'
interface Props {
    label: string
    name?: string
}
const props = defineProps<Props>()

// 从父组件注入 activeName，提供默认值
const activeName = inject('activeName', ref(''))

// 计算当前 tab 是否激活
const isActive = computed(() => {
    return activeName.value === props.label
})
</script>

<style lang="scss" scoped></style>
